/*   
 * Copyright (c) 2011, TUgether, TU Braunschweig
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
 /**
 * @author Mohamed Karray <mohamed.karray@gmx.de>
 *
 */
 

package de.tu_bs.tugether.liferayunit.liferayPages;

import java.net.URL;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

import de.tu_bs.tugether.liferayunit.liferayElements.portlets.Portlet;

public class MaximizedPortletPage<T extends Portlet> extends LiferayPage{

	T portlet;
	
	public MaximizedPortletPage(HtmlPage htmlPage) throws  Exception {
		super(htmlPage);
	}

	
	
	public MaximizedPortletPage(URL url, BrowserVersion browserVersion,
			String proxyHost, int port) throws Exception {
		super(url, browserVersion, proxyHost, port);
	}

	

	public MaximizedPortletPage(URL url) throws Exception {
		super(url);
	}



	@SuppressWarnings("unchecked")
	public void initialize() throws Exception{
		super.initialize();

		HtmlElement htmlElement = super.getFirstByXPathKey(XPATH_KEY_PORTLET);
		this.portlet = (T) new Portlet(htmlElement,this);
	}

	public boolean returnToFullPage() throws Exception{
		return this.getPortlet().goBack();
	}
	
	public  T getPortlet() {
		return portlet;
	}

	

}
